package com.itheima.homework.String类;

public class Demo6 {
    public static void main(String[] args) {
        String s="    张三,     20,       男";
        String stu = s.replace(" ", "");
        String[] split = stu.split(",");
        System.out.println(split.length);
        Student student=new Student(split[0],Integer.parseInt(split[1]),split[2].charAt(0));
        System.out.println(student.toString());

    }
}
class Student{
    private String name;
    private int age;
    private char sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public Student(String name, int age, char sex) {

        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                '}';
    }
}
